class Solution {
public:
    int countTexts(string s)
    {
        int Mod = 1e9 + 7;
        vector<int> f(1e5 + 1), g(1e5 + 1);
        f[0] = g[0] = 1;
        f[1] = g[1] = 1;
        f[2] = g[2] = 2;
        f[3] = g[3] = 4;
        for (int i = 4; i < 1e5 + 1; i++)
        {
            f[i] = (int)(((long long)f[i - 1] + f[i - 2] + f[i - 3]) % Mod);
            g[i] = (int)(((long long)g[i - 1] + g[i - 2] + g[i - 3] + g[i - 4]) % Mod);
        }

        int ans = 1;
        int count = 0;
        for (int i = 0; i < s.size(); i++)
        {
            count++;
            char c = s[i];
            if (i == s.size() - 1 || s[i + 1] != c)
            {
                ans = (int)((long long)ans * ((c != '7' && c != '9') ? f[count] : g[count]) % Mod);
                count = 0;
            }

        }
        return ans;
    }
};